import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import vitePluginUniRouter from './src/uni_modules/uni-simple-router/compiler'  
// https://vitejs.dev/config/
//import commonjs from '@rollup/plugin-commonjs';//引入commojs

export default defineConfig({
  plugins: [
	vitePluginUniRouter({  
	      pluginPath: `./uni_modules/uni-simple-router`,   
		  routesMain:`./router/index.js`
	}), 
    uni(),
  ],
  css: {
      preprocessorOptions: {
        less: {
          math: "always", // 括号内才使用数学计算
          globalVars: {
            // 全局变量
            mainColor: "red",
          },
        },
      },
  },
  server: {
		proxy : {
			"/api" : {
				"target" : "http://zp.apesk.net/api",
				"changeOrigin" : true,
				"secure" : true,
				 "rewrite": path => {
					return path.replace(/^\/api/, '')
				}
			} 
		},
		// https:{
		// 	"cert": "-----BEGIN CERTIFICATE-----\nMIIEZTCCAs2gAwIBAgIRANdsWgNtltk3t35Tdtb3Ir0wDQYJKoZIhvcNAQELBQAw\ngZkxHjAcBgNVBAoTFW1rY2VydCBkZXZlbG9wbWVudCBDQTE3MDUGA1UECwwuTEFQ\nVE9QLU5WMzZUUkJPXGJlY2toQExBUFRPUC1OVjM2VFJCTyAo5qKB5p2wKTE+MDwG\nA1UEAww1bWtjZXJ0IExBUFRPUC1OVjM2VFJCT1xiZWNraEBMQVBUT1AtTlYzNlRS\nQk8gKOaigeadsCkwHhcNMjMwNzI1MDA1NjMxWhcNMjUxMDI1MDA1NjMxWjBiMScw\nJQYDVQQKEx5ta2NlcnQgZGV2ZWxvcG1lbnQgY2VydGlmaWNhdGUxNzA1BgNVBAsM\nLkxBUFRPUC1OVjM2VFJCT1xiZWNraEBMQVBUT1AtTlYzNlRSQk8gKOaigeadsCkw\nggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGbJVBY6V3J1SEGrxj54sn\nXDmjpU1/fp2npSOwwqaPwvUPTjEonaoJxYlQKDoUgXyyRKSgt3wAcQICobN0gEKV\nsyGVTpmMi9EuMY7zF/GQ8s5nILZ9a1plW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